import matplotlib.pyplot as plt
import numpy as np
import math

y = [0] * 4  #先创建一个列表
#0print(y)

print('qing  shu ru:')
for i in range(0, 4):
    a = input(); #输入
    a = float(a)   #转换数据类型
    y[i] = a
print(y)

T = 1
K = [1,2,3,4]
t = [0] * len(K)

for i in range(0, 4):
    t[i] = (K[i] - 1) * T
xhat = (1 / len(t)) * sum(y)

plt.xlabel('t')
plt.ylabel('xhat and true')
plt.plot(t, y,'+')
plt.axhline(y = xhat, c = "k", ls ="--", lw = 2)#平行与X轴的线，y = xhat
plt.show()